<template>
  <div class="hello">
    
     <input id="input_text" v-model="inputValue">
     <button @click="send()" >确认</button>
     <button @click="submit()" >确认（异步保存）</button>
  </div>
</template>

<script>
//import index from '../store/index'
export default {
  name: 'scanf',
  data () {
    return {
     
      //难点
      inputValue:this.$store.state.counter
    }
  },
  mounted(){
   window.sendThis=this.sendThis
    
},
   methods:{
    send(){
      this.$store.commit('increment')
      console.log('send')
      
     },
    submit(){
      this.$store.dispatch('update')  
      console.log('submit')
     },
     sendThis(data){
        data=this.inputValue
     }
   }
  
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
